package cn.itcast.bos.service.base.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.dao.base.IAreaRepository;
import cn.itcast.bos.domain.base.Area;
import cn.itcast.bos.service.base.IAreaService;

@Service
@Transactional
public class AreaServiceImpl implements IAreaService {
    // z注入dao
    @Autowired
    private IAreaRepository areaRepository;

    // 导入Excel文件
    @Override
    public void batchImportArea(List<Area> areas) {
        // TODO Auto-generated method stub
        areaRepository.save(areas);
    }

    // 有条件分页查询
    @Override
    public Page<Area> pageQueryArea(Specification<Area> specification, Pageable pageable) {
        // TODO Auto-generated method stub
        return areaRepository.findAll(specification, pageable);
    }

    // 查询全部
    @Override
    public List<Area> findAllArea() {
        // TODO Auto-generated method stub
        return areaRepository.findAll();
    }

}
